﻿using System.Timers;

namespace WorldOfMUDra
{
    public class Ticker
    {
        readonly Timer _aTimer = new Timer();

        public Ticker()
        {
            _aTimer.Elapsed += OnTick;
            // Set the Interval to 1 seconds.
            _aTimer.Interval = 1000;
        }
        public Ticker(int interval)
        {
            _aTimer.Elapsed += OnTick;
            _aTimer.Interval = interval;
        }

        public void Start()
        {
            _aTimer.Enabled = true;
        }

        public void Stop()
        {
            _aTimer.Enabled = false;
        }

        protected virtual void OnTick(object source, ElapsedEventArgs e) { }
    }
}
